<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>数据字典</title>
    <style type="text/css">
        body {
            width: 800px;
            margin: 40px auto;
            font-family: arial,"Hiragino Sans GB","Microsoft Yahei",sans-serif;
            font-size: 14px;
            color: #444;
        }

        table {
            *border-collapse: collapse; /* IE7 and lower */
            border-spacing: 0;
            width: 100%;
            margin-bottom:50px;
        }

        table caption {
            font-size:20px;
            height:40px;
            line-height:40px;
        }

        .bordered {
            border: solid #ccc 1px;
            -moz-border-radius: 6px;
            -webkit-border-radius: 6px;
            border-radius: 6px;
            -webkit-box-shadow: 0 1px 1px #ccc;
            -moz-box-shadow: 0 1px 1px #ccc;
            box-shadow: 0 1px 1px #ccc;
        }

        .bordered tr:hover {
            background: #fbf8e9;
            -o-transition: all 0.1s ease-in-out;
            -webkit-transition: all 0.1s ease-in-out;
            -moz-transition: all 0.1s ease-in-out;
            -ms-transition: all 0.1s ease-in-out;
            transition: all 0.1s ease-in-out;
        }

        .bordered td, .bordered th {
            border-left: 1px solid #ccc;
            border-top: 1px solid #ccc;
            padding: 10px;
            text-align: center;
        }

        .bordered th {
            background-color: #dce9f9;
            background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
            background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
            background-image:    -moz-linear-gradient(top, #ebf3fc, #dce9f9);
            background-image:     -ms-linear-gradient(top, #ebf3fc, #dce9f9);
            background-image:      -o-linear-gradient(top, #ebf3fc, #dce9f9);
            background-image:         linear-gradient(top, #ebf3fc, #dce9f9);
            -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
            -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
            box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
            border-top: none;
            text-shadow: 0 1px 0 rgba(255,255,255,.5);
        }

        .bordered td:first-child, .bordered th:first-child {
            border-left: none;
        }

        .bordered th:first-child {
            -moz-border-radius: 6px 0 0 0;
            -webkit-border-radius: 6px 0 0 0;
            border-radius: 6px 0 0 0;
        }

        .bordered th:last-child {
            -moz-border-radius: 0 6px 0 0;
            -webkit-border-radius: 0 6px 0 0;
            border-radius: 0 6px 0 0;
        }

        .bordered th:only-child{
            -moz-border-radius: 6px 6px 0 0;
            -webkit-border-radius: 6px 6px 0 0;
            border-radius: 6px 6px 0 0;
        }

        .bordered tr:last-child td:first-child {
            -moz-border-radius: 0 0 0 6px;
            -webkit-border-radius: 0 0 0 6px;
            border-radius: 0 0 0 6px;
        }

        .bordered tr:last-child td:last-child {
            -moz-border-radius: 0 0 6px 0;
            -webkit-border-radius: 0 0 6px 0;
            border-radius: 0 0 6px 0;
        }
    </style>
</head>
<body>
    <div id="box">
        <?php if(isset($content)):?>
            <?php foreach($content as $table => $item): ?>
            <table class="bordered">
                <caption><?php echo $table ?></caption>
                <thead>
                <tr>
                    <th>名称</th>
                    <th>类型</th>
                    <th>属性</th>
                    <th>是否可空</th>
                    <th>默认值</th>
                    <th>是否主键</th>
                    <th>额外</th>
                    <th>注释</th>
                </tr>
                </thead>
                <?php foreach($item as $field => $val): ?>
                    <tr>
                        <td><?php echo $field;?></td>
                        <td><?php echo $val['type'];?></td>
                        <td><?php echo $val['attr'] ? $val['attr'] : '无';?></td>
                        <td><?php echo $val['is_null'] == 'NO' ? '√' : '×';?></td>
                        <td><?php echo $val['default'] ? $val['default'] : '无';?></td>
                        <td><?php echo $val['is_pri'] == 'PRI' ? '√' : '×';?></td>
                        <td><?php echo $val['extra'] ? $val['extra'] : '无';?></td>
                        <td><?php echo $val['zs'] ? $val['zs'] : '无';?></td>
                    </tr>
                <?php endforeach;?>
            </table>
            <?php endforeach;?>
        <?php elseif(isset($error)):?>
            <div style="text-align:center;background:orange;height:50px;color:#fff;line-height:50px;"><?php echo $error;?></div>
        <?php endif;?>
    </div>
</body>
</html>